package com.pubinfo.passbook.data.quartz.task;

import com.pubinfo.passbook.data.service.MssService;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Slf4j
@DisallowConcurrentExecution //作业不并发
@Component
public class SyncGetInstanceStatusJob implements Job {
  
  @Resource
  MssService mssService;
  
  @SneakyThrows
  @Override
  //定时获取账单状态
  public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
    //本系统发起的报账状态更新（需要发短信）
    mssService.getWriteoffInstStatus();
    //非本系统发起的报账状态更新（不需要发短信）
    mssService.getOpenWriteoffInstStatus();
  }
}
